let timer

export function debounce(fn,delay){
    clearTimeout(timer)
    timer = setTimeout(()=>{
        fn();
    },delay);
}


let lastCall = 0
 
/**
*节流函数
*/
export function throttle(fn,delay){
    const now = new Date().getTime();
    if(now-lastCall<delay){
        return
    }
    lastCall = now
    fn.apply(this,arguments)  
}